package com.leostadyn.stackfarm.timestatistics.view.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;

import com.leostadyn.stackfarm.timestatistics.base.BaseActivity;
import com.leostadyn.stackfarm.timestatistics.presenter.BasePresenter;
import com.leostadyn.stackfarm.timestatistics.view.vinterface.BaseView;

public abstract class MVPActivity<V extends BaseView, T extends BasePresenter<V>> extends BaseActivity implements BaseView{
    protected T mPresenter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPresenter=createPresenter();
        mPresenter.attachView((V)this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mPresenter.detachView();
    }

    protected abstract T createPresenter();
}
